#include "stdafx.h"
#include "../include/Gs.h"

// Tests context functionality.
class ContextTests : public cfixcc::TestFixture
{
public:
	// Tests basic context functions.
	void CreateObjects()
	{
		// create context
		Gs::IContext *context = Gs::CreateContext();
		CFIXCC_ASSERT_NOT_EQUALS((Gs::IContext *)0, context);

		// create object
		CFIXCC_ASSERT_NOT_EQUALS((Gs::IObject *)0, context->CreateObject());

		// create and verify string
		const char *helloWorld = "Hello, world!";
		Gs::IString *s = context->CreateString(helloWorld);
		CFIXCC_ASSERT_NOT_EQUALS((Gs::IString *)0, s);
		CFIXCC_ASSERT_EQUALS(0, strcmp(s->GetCString(), helloWorld));

		context->Release();
	}

	// Tests basic context functions.
	void ManipulateStack()
	{
		// create context
		Gs::IContext *context = Gs::CreateContext();
		CFIXCC_ASSERT_NOT_EQUALS((Gs::IContext *)0, context);

		context->Release();
	}
};

CFIXCC_BEGIN_CLASS(ContextTests)
	CFIXCC_METHOD(CreateObjects)
	CFIXCC_METHOD(ManipulateStack)
CFIXCC_END_CLASS()